# *********************************************************************
class DBInterface(object):
	"""Interface base class for all SQL-like data sources.
	
	DBObject uses this interface for reading, searching, and storing
	the data for each object type. Because this source is not tied to
	a specific database or even a database at all, any source such as
	a flatfile system, directory system, or web server can be used as
	a data source provided that the following methods are supported.
	"""
	
	# -------------------------------------------------------------------
	def Search(self, objs, cond, fields = None):
		"""Searches for objects matching the specified types and condition,
		optionally retrieving only the fields listed.
		
		SQL Equivalent:	SELECT
		"""
		raise NotImplemented()
		
	# -------------------------------------------------------------------
	def Create(self, obj):
		"""Creates the object type in the system if it has not already been
		registered. If a previous version of the object is found, it should
		be modified so that it matches the new definition.
		
		SQL Equivalent:	CREATE TABLE
		"""
		raise NotImplemented()
		
	# -------------------------------------------------------------------
	def Destroy(self, obj):
		"""Removes the object type from the system.
		
		SQL Equivalent:	DROP TABLE
		"""
		raise NotImplemented()
		
	# -------------------------------------------------------------------
	def Insert(self, obj):
		"""Inserts a new object into the system, or with a matching id
		attribute, updates the object to the new fields.
		
		SQL Equivalent:	INSERT, UPDATE
		"""
		raise NotImplemented()
		
	# -------------------------------------------------------------------
	def Delete(self, obj, cond):
		"""Deletes the objects matching the specified type and condition.
		
		SQL Equivalent:	DELETE FROM
		"""
		raise NotImplemented()
